var fs = require('fs');
const { src, dest } = require('gulp');
var htmlparser2 = require('htmlparser2');
var parse5 = require('parse5');
var replace = require('gulp-string-replace');
function reaFile(cb) {
  src('./static/**/*')
    .pipe(dest('./site'))
  src('./site/*/*.html')
    .pipe(replace(new RegExp('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js', 'g'),'../js/highlight.min.js'))
    .pipe(replace(new RegExp('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/github.min.css', 'g'),'../css/github.min.css'))
    .pipe(dest('./site'))
  
  src('./site/*.html')
    .pipe(replace(new RegExp('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js', 'g'),'js/highlight.min.js'))
    .pipe(replace(new RegExp('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/github.min.css', 'g'),'css/github.min.css'))
    .pipe(dest('./site'))
  cb()
}
exports.default = reaFile;
